package com.mca.framework.stream;

import java.util.Arrays;
import java.util.List;
import java.util.stream.Collectors;

public class DemoSkip {

    public static void main(String[] args) {
        List<Integer> numberList = Arrays.asList(1, 2, 3, 4, 5, 6, 7, 66, -12);
        //跳过前面的n个元素，从后面进行读取 limit个元素
        List<Integer> result = numberList.stream().skip(4).limit(5).collect(Collectors.toList());
        System.out.println(result);


        List<Integer> numberTempList =
                Arrays.asList(1, 2, 3, 4, 1, 2, 3, 4);
        List<Integer> collect =
                numberTempList.stream().limit(5).skip(2).collect
                        (Collectors.toList());
        System.out.println(collect);
    }
}
